/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       blend_window.cpp

	$Header: /game/blend_window.cpp $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "blend_window.h"

#include "convert_16_bit.h"
#include "paint_surface.h"

t_blend_window::t_blend_window( t_pixel_24 color, t_uint8 alpha, t_screen_rect const& rect, 
							    t_window* parent )
              : t_window( k_some_transparency, parent )
{
	m_color = convert_to_16_bit( color );
	m_alpha = alpha;
	if (m_alpha < 0)
		m_alpha = 0;
	if (m_alpha > 15)
		m_alpha = 15;
	init( rect );
}

void t_blend_window::paint( t_paint_surface& paint_surface )
{
	t_abstract_bitmap16_ptr	dest = paint_surface.get_bitmap();
	t_screen_rect           rect = paint_surface.get_screen_rect();

	rect = intersection( rect, get_screen_rect() );
	if (rect.width() <= 0 || rect.height() <= 0)
		return;

	rect -= rect.top_left();
	fill( *dest, rect, m_color, m_alpha );
}
